import { useRef, useState } from "react"
function Home() {
    let num = useRef(0);
    let list =  useRef([1,2,3,4])
    console.log(num);
    let [msg,setMsg] = useState(100)
    return (
        <div>
            <h3>useref 保存数据 -----{num.current}----{msg}</h3>
            <ul>
                {
                    list.current.map((item,index)=>{
                        return <li key={index}>{item}</li>
                    })
                }
            </ul>
            <button onClick={() => {
                list.current.push(10)
                num.current++
                setMsg(msg+10)
            }}>add</button>
        </div>
    )
}
export default Home